package cn.edu.nwpu.warehousemanagement.pojo;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
@Entity
@Table(name = "product_sales_prediction")
public class ProductSalesPrediction {
    @Id
    @Column(name = "product_id")
    private String productId;

    private Double day_1;
    private Double day_2;
    private Double day_3;
    private Double day_4;
    private Double day_5;
    private Double day_6;
    private Double day_7;
    private Double day_8;
    private Double day_9;
    private Double day_10;
    private Double day_11;
    private Double day_12;
    private Double day_13;
    private Double day_14;
    private Double day_15;

    public List<Long> getAllData() {
        // 使用菱形语法简化泛型声明
        List<Long> result = new ArrayList<>();

        // 依次处理 day_1 到 day_15 的数据
        result.add(day_1 != null ? Math.round(day_1) : null);
        result.add(day_2 != null ? Math.round(day_2) : null);
        result.add(day_3 != null ? Math.round(day_3) : null);
        result.add(day_4 != null ? Math.round(day_4) : null);
        result.add(day_5 != null ? Math.round(day_5) : null);
        result.add(day_6 != null ? Math.round(day_6) : null);
        result.add(day_7 != null ? Math.round(day_7) : null);
        result.add(day_8 != null ? Math.round(day_8) : null);
        result.add(day_9 != null ? Math.round(day_9) : null);
        result.add(day_10 != null ? Math.round(day_10) : null);
        result.add(day_11 != null ? Math.round(day_11) : null);
        result.add(day_12 != null ? Math.round(day_12) : null);
        result.add(day_13 != null ? Math.round(day_13) : null);
        result.add(day_14 != null ? Math.round(day_14) : null);
        result.add(day_15 != null ? Math.round(day_15) : null);

        // 返回处理后的结果列表
        return result;
    }
}